package com.woniuxy;

import io.jsonwebtoken.JwtBuilder;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.Date;

/**
 * @Author: 马宇航
 * @Todo: 测试Java-JWT用
 * @DateTime: 22/04/13/0013 下午 2:08
 * @Component: 成都蜗牛学苑
 **/
public class Test {
    public static void main(String[] args) {
        JwtBuilder jwtBuilder = Jwts.builder().setId("857").setSubject("admin").setIssuedAt(new Date())
                //如果我想要自定义信息放进去，然后再解密出来行不行呢？
                .claim("myMoney",188)
                .claim("myName","马宇航")
                .claim("mycity","四川省")
                .signWith(SignatureAlgorithm.HS256, "woniu");
        System.out.println(jwtBuilder.compact());
    }
}
